Skip to content

ext/reflection: Fix float default values losing precision in reflection output - #25735

Draft
jorgsowa wants to merge 1 commit into
php:masterfrom
jorgsowa:reflection-float-default-precision
Draft

jorgsowa wants to merge 1 commit into
php:masterfrom
jorgsowa:reflection-float-default-precision

Conversation

@jorgsowa

Copy link
Copy Markdown
Contributor

format_default_value() printed floats using the precision INI setting, while constant expressions go through zend_ast_export(), which uses the shortest round-trip representation. So $a = 0.30000000000000004 printed as 0.3, but $b = FOO + 0.30000000000000004 printed in full.

Follow-up #25461

format_default_value() printed floats using the precision INI setting,
while constant expressions go through zend_ast_export(), which uses the
shortest round-trip representation. So $a = 0.30000000000000004 printed
as 0.3, but $b = FOO + 0.30000000000000004 printed in full.
@jorgsowa jorgsowa self-assigned this Nov 25, 2026
@jorgsowa
jorgsowa changed the base branch from PHP-8.6 to master November 25, 2026 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant